import {createStore} from 'redux'

function countReducer(state,action) {
  state = state || {
    count:100,
    name:"珠峰"
  }
  switch (action.type) {
    case 'add':
      return {
        ...state,
        count:state.count + action.num
      }
    case 'minus':
      return {
        ...state,
        count:state.count - action.num
      }
  
    default:
      return {
        ...state
      }
  }
}

let store = createStore(countReducer);

export default store